package com.boyaa.lxc;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class CardValue {

	/*
	 * @data int card1
	 */
	/**获取牌的类型，黑红梅方*/
	public static String getCardType(int data) {
		int type = data >> 8;
		int value = data % 256;
		switch (type) {
		case 1:
			return "diamonds"+value;

		case 2:
			return "clubs"+value;
			
		case 3:
			return "hearts"+value;

		case 4:
			return "spades"+value;
			
		default:
			return "";
			
		}
	}
	/**获取每张牌对应的id值*/
	public static int getCard(int data) {
		if (data == -1) {
			return R.drawable.card_back;
		}
		int type = data >> 8;
		int value = data % 256;
		switch (type) {
		case 1:
			return diamonds(value);

		case 2:
			return clubs(value);

		case 3:
			return hearts(value);

		case 4:
			return spades(value);
			
		default:
			return R.drawable.card_back;
			
			
		}
	}
	/**黑桃*/
	private static int spades(int value) {
		switch (value) {
		case 2:
			return R.drawable.card_spades_2;
		case 3:
			return R.drawable.card_spades_3;
		case 4:
			return R.drawable.card_spades_4;
		case 5:
			return R.drawable.card_spades_5;
		case 6:
			return R.drawable.card_spades_6;
		case 7:
			return R.drawable.card_spades_7;
		case 8:
			return R.drawable.card_spades_8;
		case 9:
			return R.drawable.card_spades_9;
		case 10:
			return R.drawable.card_spades_10;
		case 11:
			return R.drawable.card_spades_j;
		case 12:
			return R.drawable.card_spades_q;
		case 13:
			return R.drawable.card_spades_k;
		case 14:
			return R.drawable.card_spades_a;
		default:
			return R.drawable.card_back;
		}
	}
	/**红桃*/
	private static int hearts(int value) {
		switch (value) {
		case 2:
			return R.drawable.card_hearts_2;
		case 3:
			return R.drawable.card_hearts_3;
		case 4:
			return R.drawable.card_hearts_4;
		case 5:
			return R.drawable.card_hearts_5;
		case 6:
			return R.drawable.card_hearts_6;
		case 7:
			return R.drawable.card_hearts_7;
		case 8:
			return R.drawable.card_hearts_8;
		case 9:
			return R.drawable.card_hearts_9;
		case 10:
			return R.drawable.card_hearts_10;
		case 11:
			return R.drawable.card_hearts_j;
		case 12:
			return R.drawable.card_hearts_q;
		case 13:
			return R.drawable.card_hearts_k;
		case 14:
			return R.drawable.card_hearts_a;
		default:
			return R.drawable.card_back;
		}
	}
	/**梅花*/
	private static int clubs(int value) {
		switch (value) {
		case 2:
			return R.drawable.card_clubs_2;
		case 3:
			return R.drawable.card_clubs_3;
		case 4:
			return R.drawable.card_clubs_4;
		case 5:
			return R.drawable.card_clubs_5;
		case 6:
			return R.drawable.card_clubs_6;
		case 7:
			return R.drawable.card_clubs_7;
		case 8:
			return R.drawable.card_clubs_8;
		case 9:
			return R.drawable.card_clubs_9;
		case 10:
			return R.drawable.card_clubs_10;
		case 11:
			return R.drawable.card_clubs_j;
		case 12:
			return R.drawable.card_clubs_q;
		case 13:
			return R.drawable.card_clubs_k;
		case 14:
			return R.drawable.card_clubs_a;
		default:
			return R.drawable.card_back;
		}
	}
	/**方块*/
	private static int diamonds(int value) {
		switch (value) {
		case 2:
			return R.drawable.card_diamonds_2;
		case 3:
			return R.drawable.card_diamonds_3;
		case 4:
			return R.drawable.card_diamonds_4;
		case 5:
			return R.drawable.card_diamonds_5;
		case 6:
			return R.drawable.card_diamonds_6;
		case 7:
			return R.drawable.card_diamonds_7;
		case 8:
			return R.drawable.card_diamonds_8;
		case 9:
			return R.drawable.card_diamonds_9;
		case 10:
			return R.drawable.card_diamonds_10;
		case 11:
			return R.drawable.card_diamonds_j;
		case 12:
			return R.drawable.card_diamonds_q;
		case 13:
			return R.drawable.card_diamonds_k;
		case 14:
			return R.drawable.card_diamonds_a;
		default:
			return R.drawable.card_back;
		}
	}
}
